<template>
  <div id="app"></div>
</template>

<script setup lang='ts'>

import { defineCustomElement, onMounted, h } from "vue"

/**
 * 实现以下代码创建一个自定义元素.
 * 确保页面输出 "Hello Vue.js".
*/
const VueJs = defineCustomElement({
  props: {
    message: String
  },
  render() {
    return h('div', null, this.message)
  }
})

customElements.define('vue-js', VueJs)

onMounted(() => {
  document.getElementById("app")!.innerHTML = "<vue-js message=\"Hello Vue.js\"></vue-js>"
})

</script>
